home *** CD-ROM | disk | FTP | other *** search
/ Power CD / Power CD ATARI-Rechner Lieben.iso / ALLERLEI / GOBJ_112 / SOURCE / BEISPIEL / BEISPL12.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1994-04-14  |  16.6 KB  |  703 lines

  1. program Beispiel; {$X+} { Beispiel Nr.12 }
  2.  
  3. uses
  4.  
  5.     Gem,Objects,OTypes,OProcs,OWindows,OValidat,ODialogs;
  6.  
  7. const
  8.  
  9.     {$I beispiel.i}
  10.  
  11. type
  12.  
  13.     PBeispielWindow = ^TBeispielWindow;
  14.     PAttrDialog     = ^TAttrDialog;
  15.     PLineData       = ^TLineData;
  16.     PLinie          = ^TLinie;
  17.     PPunkt          = ^TPunkt;
  18.     PAbout          = ^TAbout;
  19.     PNew            = ^TNew;
  20.     POpen           = ^TOpen;
  21.     PSave           = ^TSave;
  22.     PSaveAs         = ^TSaveAs;
  23.     PInfo           = ^TInfo;
  24.     PAttrib         = ^TAttrib;
  25.  
  26.     TMyApplication = object(TApplication)
  27.         save  : PSave;
  28.         saveas: PSaveAs;
  29.         info  : PInfo;
  30.         destructor Done; virtual;
  31.         procedure InitInstance; virtual;
  32.         procedure InitMainWindow; virtual;
  33.         { neue Methoden: }
  34.         procedure UpdateInfo; virtual;
  35.     end;
  36.  
  37.     TBeispielWindow = object(TWindow)
  38.         Veraendert: boolean;
  39.         Dicke,
  40.         Farbe,
  41.         Art: integer;
  42.         Pfad,
  43.         Datei     : string;
  44.         Zeichnung : PCollection;
  45.         constructor Init(AParent: PWindow; ATitle: string);
  46.         destructor Done; virtual;
  47.         procedure GetWindowClass(var AWndClass: TWndClass); virtual;
  48.         function GetClassName: string; virtual;
  49.         function GetStyle: integer; virtual;
  50.         function GetScroller: PScroller; virtual;
  51.         function CanClose: boolean; virtual;
  52.         procedure Paint(var PaintInfo: TPaintStruct); virtual;
  53.         procedure WMButton(mX,mY,BStat,KStat,Clicks: integer); virtual;
  54.         { neue Methoden: }
  55.         procedure SetAttr(Width,Color,Style: integer); virtual;
  56.         procedure CreateTitle; virtual;
  57.         procedure Speichern; virtual;
  58.     end;
  59.  
  60.     TAttrDialog = object(TDialog)
  61.         function OK: boolean; virtual;
  62.         function Help: boolean; virtual;
  63.     end;
  64.  
  65.     TLineData = record
  66.         Farben: array [0..7] of integer;
  67.         Stile : array [1..6] of integer;
  68.         Breite: string[5]
  69.     end;
  70.  
  71.     TLinie = object(TObject)
  72.         Punkte: PCollection;
  73.         Dicke,
  74.         Farbe,
  75.         Art   : integer;
  76.         constructor Init(Width,Color,Style: integer);
  77.         destructor Done; virtual;
  78.         procedure NeuerPunkt(AX,AY: integer); virtual;
  79.         procedure Zeichnen; virtual;
  80.         procedure Speichern; virtual;
  81.     end;
  82.  
  83.     TPunkt = object(TObject)
  84.         X,
  85.         Y: integer;
  86.         constructor Init(AX,AY: integer);
  87.     end;
  88.  
  89.     TAbout  = object(TKeyMenu)
  90.         procedure Work; virtual;
  91.     end;
  92.  
  93.     TNew    = object(TKeyMenu)
  94.         procedure Work; virtual;
  95.     end;
  96.  
  97.     TOpen   = object(TKeyMenu)
  98.         procedure Work; virtual;
  99.     end;
  100.  
  101.     TSave   = object(TKeyMenu)
  102.         procedure Work; virtual;
  103.     end;
  104.  
  105.     TSaveAs = object(TKeyMenu)
  106.         procedure Work; virtual;
  107.     end;
  108.  
  109.     TInfo   = object(TKeyMenu)
  110.         st1,
  111.         st2: PStatic;
  112.         procedure Work; virtual;
  113.         procedure BerechneWerte; virtual;
  114.     end;
  115.  
  116.     TAttrib = object(TKeyMenu)
  117.         LineData: TLineData;
  118.         procedure Work; virtual;
  119.     end;
  120.  
  121. var
  122.  
  123.     MyApp: TMyApplication;
  124.     f    : file of integer;
  125.  
  126.  
  127. procedure MyResource; external; {$L beispiel.o}
  128.  
  129.  
  130. destructor TMyApplication.Done;
  131.  
  132.     begin
  133.         SliceMouse;
  134.         with PBeispielWindow(MainWindow)^ do
  135.             if WritePrivateProfileString('Datei','Pfad',Pfad,'BEISPIEL.INF') then
  136.                 begin
  137.                     SliceMouseNext;
  138.                     WritePrivateProfileInt('Attribute','Dicke',Dicke,'BEISPIEL.INF');
  139.                     SliceMouseNext;
  140.                     WritePrivateProfileInt('Attribute','Farbe',Farbe,'BEISPIEL.INF');
  141.                     SliceMouseNext;
  142.                     WritePrivateProfileInt('Attribute','Stil',Art,'BEISPIEL.INF')
  143.                 end;
  144.         ArrowMouse;
  145.         inherited Done
  146.     end;
  147.  
  148.  
  149. procedure TMyApplication.InitInstance;
  150.  
  151.     begin
  152.         OpenPrivateProfile('BEISPIEL.INF');
  153.         InitResource(@MyResource,nil);
  154.         LoadMenu(BSPMENU);
  155.         new(PAbout,Init(@self,K_CTRL,Ctrl_A,MABOUT,MTITLE1));
  156.         new(PNew,Init(@self,K_CTRL,Ctrl_N,MNEW,MTITLE2));
  157.         new(POpen,Init(@self,K_CTRL,Ctrl_O,MOPEN,MTITLE2));
  158.         save:=new(PSave,Init(@self,K_CTRL,Ctrl_S,MSAVE,MTITLE2));
  159.         saveas:=new(PSaveAs,Init(@self,K_CTRL,Ctrl_D,MSAVEAS,MTITLE2));
  160.         info:=new(PInfo,Init(@self,K_CTRL,Ctrl_I,MINFO,MTITLE3));
  161.         new(PAttrib,Init(@self,K_CTRL,Ctrl_T,MATTR,MTITLE3));
  162.         inherited InitInstance;
  163.         SetQuit(MQUIT,MTITLE2);
  164.         save^.Disable;
  165.         saveas^.Disable
  166.     end;
  167.  
  168.  
  169. procedure TMyApplication.InitMainWindow;
  170.  
  171.     begin
  172.         new(PBeispielWindow,Init(nil,'Beispiel  [unbenannt]'));
  173.         if (MainWindow=nil) or (ChkError<em_OK) then
  174.             Status:=em_InvalidMainWindow
  175.     end;
  176.  
  177.  
  178. procedure TMyApplication.UpdateInfo;
  179.  
  180.     begin
  181.         if info^.ADialog<>nil then
  182.             if info^.ADialog^.Attr.Status=ws_Open then
  183.                 info^.BerechneWerte
  184.     end;
  185.  
  186.  
  187. constructor TBeispielWindow.Init(AParent: PWindow; ATitle: string);
  188.  
  189.     begin
  190.         if not(inherited Init(AParent,ATitle)) then fail;
  191.         new(Zeichnung,Init(10,10));
  192.         Veraendert:=false;
  193.         BusyMouse;
  194.         Pfad:=GetPrivateProfileString('Datei','Pfad','','BEISPIEL.INF');
  195.         Dicke:=GetPrivateProfileInt('Attribute','Dicke',3,'BEISPIEL.INF');
  196.         Farbe:=GetPrivateProfileInt('Attribute','Farbe',Blue,'BEISPIEL.INF');
  197.         Art:=GetPrivateProfileInt('Attribute','Stil',LT_SOLID,'BEISPIEL.INF');
  198.         ArrowMouse;
  199.         SetAttr(Dicke,Farbe,Art);
  200.         Datei:=''
  201.     end;
  202.  
  203.  
  204. destructor TBeispielWindow.Done;
  205.  
  206.     begin
  207.         dispose(Zeichnung,Done);
  208.         inherited Done
  209.     end;
  210.  
  211.  
  212. function TBeispielWindow.CanClose: boolean;
  213.     var valid: boolean;
  214.  
  215.     begin
  216.         valid:=inherited CanClose;
  217.         if valid and Veraendert then
  218.             valid:=(Application^.Alert(@self,1,WAIT,
  219.                 ' Die Grafik wurde verändert!| Wollen Sie sie speichern?',
  220.               '&Ja|  &Nein  ')=2);
  221.         CanClose:=valid
  222.     end;
  223.  
  224.  
  225. procedure TBeispielWindow.GetWindowClass(var AWndClass: TWndClass);
  226.  
  227.     begin
  228.         inherited GetWindowClass(AWndClass);
  229.         AWndClass.hCursor:=IDC_PENCIL
  230.     end;
  231.  
  232.  
  233. function TBeispielWindow.GetClassName: string;
  234.  
  235.     begin
  236.         GetClassName:='BeispielWindow'
  237.     end;
  238.  
  239.  
  240. function TBeispielWindow.GetStyle: integer;
  241.  
  242.     begin
  243.         GetStyle:=inherited GetStyle or SLIDER
  244.     end;
  245.  
  246.  
  247. function TBeispielWindow.GetScroller: PScroller;
  248.  
  249.     begin
  250.         GetScroller:=new(PScroller,Init(@self,128,64,
  251.                          Application^.Attr.MaxPX shr 6,
  252.                          Application^.Attr.MaxPY shr 5))
  253.     end;
  254.  
  255.  
  256. procedure ZeichneLinienzug(p: PLinie);
  257.  
  258.     begin
  259.         p^.Zeichnen
  260.     end;
  261.  
  262.  
  263. procedure TBeispielWindow.Paint(var PaintInfo: TPaintStruct);
  264.  
  265.     begin
  266.         Zeichnung^.ForEach(@ZeichneLinienzug)
  267.     end;
  268.  
  269.  
  270. procedure TBeispielWindow.WMButton(mX,mY,BStat,KStat,Clicks: integer);
  271.     var xalt,yalt,btn,dummy: integer;
  272.         sx,sy              : longint;
  273.         pxyarray           : ptsin_ARRAY;
  274.         ALinie             : PLinie;
  275.  
  276.     begin
  277.         if bTst(BStat,1) then
  278.             if GetDC>=0 then
  279.                 begin
  280.                     wind_update(BEG_MCTRL);
  281.                     sx:=Scroller^.GetXOrg;
  282.                     sy:=Scroller^.GetYOrg;
  283.                     vsl_width(vdiHandle,Dicke);
  284.                     vsl_color(vdiHandle,Farbe);
  285.                     vsl_type(vdiHandle,Art);
  286.                     vsl_ends(vdiHandle,LE_ROUNDED,LE_ROUNDED);
  287.                     ALinie:=new(PLinie,Init(Dicke,Farbe,Art));
  288.                     Zeichnung^.Insert(ALinie);
  289.                     ALinie^.NeuerPunkt(mX-sx,mY-sy);
  290.                     repeat
  291.                         xalt:=mX;
  292.                         yalt:=mY;
  293.                         repeat
  294.                             graf_mkstate(mX,mY,btn,dummy)
  295.                         until (mX<>xalt) or (mY<>yalt) or not(bTst(btn,1));
  296.                         pxyarray[0]:=xalt;
  297.                         pxyarray[1]:=yalt;
  298.                         pxyarray[2]:=mX;
  299.                         pxyarray[3]:=mY;
  300.                         v_pline(vdiHandle,2,pxyarray);
  301.                         ALinie^.NeuerPunkt(mX-sx,mY-sy)
  302.                     until not(bTst(btn,1));
  303.                     wind_update(END_MCTRL);
  304.                     ReleaseDC;
  305.                     Veraendert:=true;
  306.                     CreateTitle;
  307.                     MyApp.saveas^.Enable;
  308.                     if length(Datei)>0 then MyApp.save^.Enable;
  309.                     MyApp.UpdateInfo
  310.                 end;
  311.         if bTst(BStat,2) then
  312.             if CanClose then
  313.                 begin
  314.                     Zeichnung^.FreeAll;
  315.                     ForceRedraw;
  316.                     Veraendert:=false;
  317.                     CreateTitle;
  318.                     MyApp.save^.Disable;
  319.                     MyApp.saveas^.Disable;
  320.                     MyApp.UpdateInfo
  321.                 end
  322.     end;
  323.  
  324.  
  325. procedure TBeispielWindow.SetAttr(Width,Color,Style: integer);
  326.     const farben: array [0..7] of string[7] =
  327.         ('weiß','schwarz','rot','grün','blau','türkis','gelb','violett');
  328.                 arten: array [1..6] of string[16] =
  329.         ('durchgehend','langer Strich','Punkte','Strich, Punkt',
  330.                                      'Strich','Strich, 2 Punkte');
  331.  
  332.     begin
  333.         Dicke:=Width;
  334.         Farbe:=Color;
  335.         Art:=Style;
  336.         SetSubTitle(' Dicke: '+ltoa(Dicke)+'  Farbe: '+farben[Farbe]+
  337.                                 '   Art: '+arten[Art])
  338.     end;
  339.  
  340.  
  341. procedure TBeispielWindow.CreateTitle;
  342.     var titel: string;
  343.  
  344.     begin
  345.         if length(Datei)=0 then titel:='[unbenannt]'
  346.         else
  347.             titel:=Pfad+Datei;
  348.         if Veraendert then titel:='*'+titel;
  349.         titel:='Beispiel  '+titel;
  350.         SetTitle(titel)
  351.     end;
  352.  
  353.  
  354. procedure SpeichereLinienzug(p: PLinie);
  355.  
  356.     begin
  357.         p^.Speichern
  358.     end;
  359.  
  360.  
  361. procedure TBeispielWindow.Speichern;
  362.  
  363.     begin
  364.         BusyMouse;
  365.         assign(f,Pfad+Datei);
  366.         rewrite(f);
  367.         Zeichnung^.ForEach(@SpeichereLinienzug);
  368.         close(f);
  369.         ArrowMouse;
  370.         Veraendert:=false;
  371.         CreateTitle
  372.     end;
  373.  
  374.  
  375. function TAttrDialog.OK: boolean;
  376.     var valid: boolean;
  377.         d,f,s: integer;
  378.         attrb: ARRAY_4;
  379.  
  380.     begin
  381.         valid:=inherited OK;
  382.         if valid then
  383.             begin
  384.                 with PLineData(TransferBuffer)^ do
  385.                     begin
  386.                         f:=0;
  387.                         while Farben[f]<>bf_Checked do inc(f);
  388.                         s:=1;
  389.                         while Stile[s]<>bf_Checked do inc(s);
  390.                         vsl_width(vdiHandle,atol(Breite))
  391.                     end;
  392.                 vql_attributes(vdiHandle,attrb);
  393.                 PBeispielWindow(Application^.MainWindow)^.SetAttr(attrb[3],f,s)
  394.             end;
  395.         OK:=valid
  396.     end;
  397.  
  398.  
  399. function TAttrDialog.Help: boolean;
  400.  
  401.     begin
  402.         Application^.Alert(@self,1,NO_ICON,'In dieser Dialogbox werden die|Attribute der Linien eingestellt.|Die neuen Werte gelten ab der|ersten Linie, die nach dem|Schließen der Box gezeichnet|wird.','   &OK   ');
  403.         Help:=false
  404.     end;
  405.  
  406.  
  407. constructor TLinie.Init(Width,Color,Style: integer);
  408.  
  409.     begin
  410.         if not(inherited Init) then fail;
  411.         new(Punkte,Init(50,50));
  412.         Dicke:=Width;
  413.         Farbe:=Color;
  414.         Art:=Style
  415.     end;
  416.  
  417.  
  418. destructor TLinie.Done;
  419.  
  420.     begin
  421.         dispose(Punkte,Done);
  422.         inherited Done
  423.     end;
  424.  
  425.  
  426. procedure TLinie.NeuerPunkt(AX,AY: integer);
  427.  
  428.     begin
  429.         Punkte^.Insert(new(PPunkt,Init(AX,AY)))
  430.     end;
  431.  
  432.  
  433. procedure TLinie.Zeichnen;
  434.     const bis: integer = pred(pts_max) shr 1;
  435.  
  436.     var q,von,ppc : longint;
  437.         vh,dx,dy,c: integer;
  438.         pxyarray  : ptsin_ARRAY;
  439.  
  440.     begin
  441.         if Punkte^.Count>1 then
  442.             begin
  443.                 with Application^ do
  444.                     begin
  445.                         vh:=vdiHandle;
  446.                         dx:=MainWindow^.Scroller^.GetXOrg;
  447.                         dy:=MainWindow^.Scroller^.GetYOrg
  448.                     end;
  449.                 vsl_width(vh,Dicke);
  450.                 vsl_color(vh,Farbe);
  451.                 vsl_type(vh,Art);
  452.                 vsl_ends(vh,LE_ROUNDED,LE_ROUNDED);
  453.                 von:=0;
  454.                 ppc:=pred(Punkte^.Count);
  455.                 while von<ppc do
  456.                     begin
  457.                         c:=0;
  458.                         for q:=von to Min(von+bis,ppc) do
  459.                             with PPunkt(Punkte^.At(q))^ do
  460.                                 begin
  461.                                     pxyarray[c]:=X+dx;
  462.                                     inc(c);
  463.                                     pxyarray[c]:=Y+dy;
  464.                                     inc(c)
  465.                                 end;
  466.                         v_pline(vh,c shr 1,pxyarray);
  467.                         inc(von,bis)
  468.                     end
  469.             end
  470.     end;
  471.  
  472.  
  473. procedure TLinie.Speichern;
  474.     var q  : longint;
  475.         cnt: integer;
  476.  
  477.     begin
  478.         cnt:=Punkte^.Count;
  479.         if cnt>0 then
  480.             begin
  481.                 write(f,Dicke,Farbe,Art,cnt);
  482.                 for q:=0 to pred(cnt) do
  483.                     with PPunkt(Punkte^.At(q))^ do
  484.                         write(f,X,Y)
  485.             end
  486.     end;
  487.  
  488.  
  489. constructor TPunkt.Init(AX,AY: integer);
  490.  
  491.     begin
  492.         if not(inherited Init) then fail;
  493.         X:=AX;
  494.         Y:=AY
  495.     end;
  496.  
  497.  
  498. procedure TAbout.Work;
  499.  
  500.     begin
  501.         if ADialog=nil then
  502.             begin
  503.                 new(ADialog,Init(nil,'Über Beispiel',BSPABOUT));
  504.                 if ADialog<>nil then
  505.                     begin
  506.                         new(PGroupBox,Init(ADialog,IGROUP,'ObjectGEM '+
  507.                                                                 'Beispielprogramm','"42"'));
  508.                         new(PButton,Init(ADialog,IOK,id_OK,true,'Mit diesem '+
  509.                                             'Button|kann die Infobox|verlassen werden.'))
  510.                     end
  511.             end;
  512.         if ADialog<>nil then ADialog^.MakeWindow
  513.     end;
  514.  
  515.  
  516. procedure TNew.Work;
  517.  
  518.     begin
  519.         with PBeispielWindow(Application^.MainWindow)^ do
  520.             if CanClose then
  521.                 begin
  522.                     Zeichnung^.FreeAll;
  523.                     ForceRedraw;
  524.                     Veraendert:=false;
  525.                     Pfad:='';
  526.                     Datei:='';
  527.                     CreateTitle;
  528.                     MyApp.save^.Disable;
  529.                     MyApp.saveas^.Disable;
  530.                     MyApp.UpdateInfo
  531.                 end
  532.     end;
  533.  
  534.  
  535. procedure TOpen.Work;
  536.     var ALinie           : PLinie;
  537.         width,color,style: integer;
  538.         cnt,x,y          : integer;
  539.         q                : longint;
  540.  
  541.     begin
  542.         with PBeispielWindow(Application^.MainWindow)^ do
  543.             if FileSelect(nil,'BEISPIEL-LINIEN LADEN','*.BLN',
  544.                                             Pfad,Datei,true) then
  545.                 begin
  546.                     BusyMouse;
  547.                     Zeichnung^.FreeAll;
  548.                     assign(f,Pfad+Datei);
  549.                     reset(f);
  550.                     while not(eof(f)) do
  551.                         begin
  552.                             read(f,width,color,style,cnt);
  553.                             ALinie:=new(PLinie,Init(width,color,style));
  554.                             Zeichnung^.Insert(ALinie);
  555.                             for q:=1 to cnt do
  556.                                 begin
  557.                                     read(f,x,y);
  558.                                     ALinie^.NeuerPunkt(x,y)
  559.                                 end
  560.                         end;
  561.                     close(f);
  562.                     ArrowMouse;
  563.                     Veraendert:=false;
  564.                     CreateTitle;
  565.                     ForceRedraw;
  566.                     MyApp.save^.Enable;
  567.                     MyApp.saveas^.Enable;
  568.                     MyApp.UpdateInfo
  569.                 end
  570.     end;
  571.  
  572.  
  573. procedure TSave.Work;
  574.  
  575.     begin
  576.         PBeispielWindow(Application^.MainWindow)^.Speichern
  577.     end;
  578.  
  579.  
  580. procedure TSaveAs.Work;
  581.  
  582.     begin
  583.         with PBeispielWindow(Application^.MainWindow)^ do
  584.             if FileSelect(nil,'BEISPIEL-LINIEN SPEICHERN','*.BLN',
  585.                                             Pfad,Datei,false) then
  586.                 begin
  587.                     Speichern;
  588.                     MyApp.save^.Enable
  589.                 end
  590.     end;
  591.  
  592.  
  593. procedure TInfo.Work;
  594.  
  595.     begin
  596.         if ADialog=nil then
  597.             begin
  598.                 new(ADialog,Init(nil,'Info',BSPINFO));
  599.                 if ADialog<>nil then
  600.                     begin
  601.                         new(st1,Init(ADialog,FPOLY,22,false,'Gibt die Anzahl|der Linienzüge an.'));
  602.                         new(st2,Init(ADialog,FLINES,24,false,'Gibt die Anzahl|der Einzellinien|aller Linienzüge|an.'));
  603.                         new(PButton,Init(ADialog,FOK,id_OK,true,'Mit diesem '+
  604.                                             'Button|kann die Infobox|verlassen werden.'))
  605.                     end
  606.             end;
  607.         if ADialog<>nil then
  608.             begin
  609.                 BerechneWerte;
  610.                 ADialog^.MakeWindow
  611.             end
  612.     end;
  613.  
  614.  
  615. procedure TInfo.BerechneWerte;
  616.     var q,anz: longint;
  617.  
  618.     begin
  619.         with PBeispielWindow(Application^.MainWindow)^ do
  620.             begin
  621.                 anz:=0;
  622.                 st1^.SetText('Linienzüge:      '+ltoa(Zeichnung^.Count));
  623.                 if Zeichnung^.Count>0 then
  624.                     for q:=0 to pred(Zeichnung^.Count) do
  625.                         inc(anz,PLinie(Zeichnung^.At(q))^.Punkte^.Count);
  626.                 st2^.SetText('Linien (gesamt): '+ltoa(anz))
  627.             end
  628.     end;
  629.  
  630.  
  631. procedure TAttrib.Work;
  632.     var ed: PEdit;
  633.         q : integer;
  634.  
  635.     begin
  636.         if ADialog=nil then
  637.             begin
  638.                 ADialog:=new(PAttrDialog,Init(nil,'Attribute',BSPATTR));
  639.                 if ADialog<>nil then
  640.                     begin
  641.                         new(PGroupBox,Init(ADialog,ACGROUP,'Farbe',
  642.                                                         'Bestimmt die|Linienfarbe'));
  643.                         new(PGroupBox,Init(ADialog,ASGROUP,'Stil',
  644.                                                         'Bestimmt den|Linienstil'));
  645.                         new(PRadioButton,Init(ADialog,AWHITE,true,
  646.                                                         'Setzt Weiß als|neue Linienfarbe'));
  647.                         new(PRadioButton,Init(ADialog,ABLACK,true,
  648.                                                         'Setzt Schwarz als|neue Linienfarbe'));
  649.                         new(PRadioButton,Init(ADialog,ARED,true,
  650.                                                         'Setzt Rot als|neue Linienfarbe'));
  651.                         new(PRadioButton,Init(ADialog,AGREEN,true,
  652.                                                         'Setzt Grün als|neue Linienfarbe'));
  653.                         new(PRadioButton,Init(ADialog,ABLUE,true,
  654.                                                         'Setzt Blau als|neue Linienfarbe'));
  655.                         new(PRadioButton,Init(ADialog,ACYAN,true,
  656.                                                         'Setzt Türkis als|neue Linienfarbe'));
  657.                         new(PRadioButton,Init(ADialog,AYELLOW,true,
  658.                                                         'Setzt Gelb als|neue Linienfarbe'));
  659.                         new(PRadioButton,Init(ADialog,AMAGENTA,true,
  660.                                                         'Setzt Violett als|neue Linienfarbe'));
  661.                         new(PRadioButton,Init(ADialog,ASOLID,true,
  662.                                                         'Setzt LT_SOLID als|neuen Linienstil'));
  663.                         new(PRadioButton,Init(ADialog,ALONG,true,
  664.                                                         'Setzt LT_LONGDASH als|neuen Linienstil'));
  665.                         new(PRadioButton,Init(ADialog,ADOTS,true,
  666.                                                         'Setzt LT_DOTTED als|neuen Linienstil'));
  667.                         new(PRadioButton,Init(ADialog,ALINEDOT,true,
  668.                                                         'Setzt LT_DASHDOT als|neuen Linienstil'));
  669.                         new(PRadioButton,Init(ADialog,ALINE,true,
  670.                                                         'Setzt LT_DASHED als|neuen Linienstil'));
  671.                         new(PRadioButton,Init(ADialog,ALIN2DOT,true,
  672.                                                         'Setzt LT_DASHDOTDOT|als neuen Linienstil'));
  673.                         ed:=new(PEdit,Init(ADialog,AWIDTH,5,
  674.                                     'Gibt die Linien-|stärke an (1,3,..).|Immer UNgerade!'));
  675.                         new(PButton,Init(ADialog,ACANCEL,id_Cancel,true,
  676.                             'Bricht den Dialog ab,|ohne die neuen Werte|zu übernehmen'));
  677.                         new(PButton,Init(ADialog,AOK,id_OK,true,
  678.                                                     'Beendet den Dialog und|setzt die neuen Werte'));
  679.                         new(PButton,Init(ADialog,AHELP,id_Help,false,
  680.                             'Zeigt einen allgemeinen|Hilfstext über diesen|Dialog an.'));
  681.                         fillchar(LineData,sizeof(LineData),0);
  682.                         with PBeispielWindow(Application^.MainWindow)^ do
  683.                             with LineData do
  684.                                 begin
  685.                                     for q:=0 to 7 do Farben[q]:=bf_Unchecked;
  686.                                     for q:=1 to 6 do Stile[q]:=bf_Unchecked;
  687.                                     Farben[Farbe]:=bf_Checked;
  688.                                     Stile[Art]:=bf_Checked;
  689.                                     Breite:=ltoa(Dicke)
  690.                                 end;
  691.                         ADialog^.TransferBuffer:=@LineData;
  692.                         ed^.SetValidator(new(PRangeValidator,Init(1,99)))
  693.                     end
  694.             end;
  695.         if ADialog<>nil then ADialog^.MakeWindow
  696.     end;
  697.  
  698.  
  699. begin
  700.     MyApp.Init('BSPL','Beispiel');
  701.     MyApp.Run;
  702.     MyApp.Done
  703. end.